.tag-list-item {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

.tag-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;

  .tag-list-title {
    display: flex;
    flex: none;
    justify-content: space-between;
    align-items: center;
    line-height: 1.25em;
    margin-bottom: 0.25em;

    h2 {
      margin-bottom: 0;
    }

    .tag-list-edit-toggle {
      opacity: 0;

      .touch-enabled & {
        opacity: 1;
      }
      &:active {
        color: $studio-white;
      }
    }
  }

  &:hover,
  &.tag-list-editing {
    .tag-list-title .tag-list-edit-toggle {
      opacity: 1;
    }
  }

  &.tag-list-editing .tag-list-items {
    padding-inline-start: 6px;
  }
}

.tag-list-items {
  flex: 1 1 auto;
  list-style: none;
  padding-inline-start: 20px;
  padding-inline-end: 16px;
  padding-top: 0;
  padding-bottom: 0;
  overflow-y: auto;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;

  svg {
    cursor: pointer;
  }

  .icon-trash {
    margin-right: 5px;
    &:hover {
      color: red;
    }
  }
}

.tag-list-input {
  cursor: pointer;
  flex: 1 1 auto;
  display: block;
  width: 50px;
  height: 2em;
  line-height: 2em;
  margin: 8px 0;
  padding: 0;
  border: none;
  text-overflow: ellipsis;
  font-size: 100%;
  background: none;
  appearance: none;

  &.is-selected {
    color: $studio-simplenote-blue-50;
  }

  &:focus {
    outline: none;
  }
}

.tag-list-editing {
  .tag-list-input {
    cursor: text;
  }
}

.editable-list {
  display: flex;
  flex-direction: column;
  overflow: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
  list-style: none;

  .editable-list-item {
    display: flex;
    flex: none;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 10;
    transition: $anim;

    svg {
      vertical-align: middle;
    }
  }

  &.editable-list-reordering .editable-list-item {
    transition: none;

    * {
      cursor: ns-resize;
    }
  }

  .editable-list-item-reordering {
    z-index: 0;
  }

  .editable-list-item-left {
    display: flex;
    align-items: center;
    flex: 1 0 auto;
    transition: $anim;
    transform: translateX(0);
  }

  &.editable-list-removable .editable-list-item-left {
    transform: translateX(-24px);
  }

  .editable-list-item-content {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
  }

  .editable-list-trash,
  .editable-list-reorder {
    cursor: pointer;
    flex: none;
    opacity: 0;
    pointer-events: none;
    transition: $anim;

    svg {
      transition: $anim;
    }

    &:focus {
      outline: none;
    }
  }

  .editable-list-trash {
    width: 22px;
    margin-right: 4px;

    svg {
      fill: $studio-red-40;
    }

    &:focus svg {
      fill: darken($studio-red-40, 20%);
    }
  }

  .editable-list-reorder {
    display: flex;
    align-items: center;
    flex: none;
    transform: translateX(24px);

    svg {
      fill: $studio-gray-50;
    }

    &:focus svg {
      fill: $studio-gray-80;
    }
  }

  &.editable-list-editing {
    .editable-list-item-left {
      transform: translateX(-4px);
    }

    .editable-list-trash {
      opacity: 1;
      pointer-events: auto;
    }

    .editable-list-reorder {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(0);
    }
  }
}
